export default {
	namespaced: true,
	state: {
		form: {
			name: "",
			urls: "",
			level: "0", //菜单级别
			father: [], //选择父菜单
		},
		temporaryFatherData: [] //树状菜单列表
	},
	mutations: {
		clearForm(state) {
			state.form = {
				name: "",
				urls: "",
				level: "0", //菜单级别
				father: [], //选择父菜单
			}
		},
		udpateForm(state, data) {
			var tempLevel = '0';
			if(data.cbm_fid != '0') {
				tempLevel = '1';
			}

			state.form = {
				name: data.cbm_name,
				urls: data.cbm_url,
				level: tempLevel, //菜单级别
				father: data.cbm_fid_path.split(','), //选择父菜单
			}
		},
		//更新菜单信息
		updateTemporaryFatherData(state, data) {
			state.temporaryFatherData = data
		},
	}
}